package TestCases;

import java.io.FileNotFoundException;

import XMLScene.*;
import Tracer.*;
import junit.framework.TestCase;

public class RTPigmentTest extends TestCase {
	String path = "earthmap.ppm";
	RTSurface colorSurface = new RTSurface(new RTColor(0.5f, 0.5f, 0.5f));
	RTSurface imageSurface;

	public RTPigmentTest(String name) {
		super(name);
	}

	protected void setUp() throws Exception {
		super.setUp();
		try {
			imageSurface = new RTSurface(path);
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	protected void tearDown() throws Exception {
		super.tearDown();
		imageSurface = null;
		colorSurface = null;
		path = null;
	}

	/**
	 * Test method for testGetColor. Test it works well after performing
	 * testGetColor
	 */
	public final void testGetColor() {
		assertTrue("Wrong color returned", colorSurface.getPigment().getColor()
				.isEqual(new RTColor(0.5f, 0.5f, 0.5f)));
	}

	/**
	 * Test method for testGetBitmap. Test it works well after performing
	 * testGetBitmap
	 */
	public final void testGetBitmap() {
		assertEquals("Wrong color returned", 640, imageSurface.getPigment()
				.getBitmap().width());
	}
}
